

    const config = require('../config/db-config');
    const Sequelize = require("sequelize");
    const {QueryTypes, DataTypes} = require('sequelize');

    let sequelizeObj = new Sequelize(
        config.mysql.database,
        config.mysql.user,
        config.mysql.password,
        config.sequelize
    );

    const user = require('../model/user')(sequelizeObj, DataTypes);
    const role = require('../model/role')(sequelizeObj, DataTypes);

    role.hasMany(user, {
        foreignKey: 'roleid',
        sourceKey: 'roleid'
    })

    user.belongsTo(role, {
        foreignKey: 'roleid',
        sourceKey: 'roleid'
    })

    module.exports = {user, role}